package com.card.game.event;

import java.util.Iterator;
import java.util.Vector;

import com.card.game.Card;
import com.card.game.CardUtils;
import com.card.game.Hand;
import com.card.game.Player;
import com.card.game.room.SHRoom;

/**   
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author siyunlong  
 * @date 2016年8月22日 上午10:38:42 
 * @version V1.0   
 */
public class EventUtils {
	public static void checkGenZhuang(SHRoom room,Player player) {
//		if(player.getOutCards().size() == 1) {
//			Vector<Card> cc = new Vector<>();
//			Iterator<Player> it = room.getPlayerList().iterator();
//			while (it.hasNext()) {
//				Card temp = it.next().getPlayerInfo().getFirstOut();
//				if(temp != null) cc.add(temp);
//			}
//			if(cc.size() == 4 && CardUtils.isSameCard(cc)) {
//				room.getGameResult().setGenZhuang(true);
//				room.broadSkill(EventType.GenZhuang);
//			}
//		}
	}
	
	public static boolean doPeng(Vector<Card> cards,Card outCard) {
		Vector<Card> sour = (Vector<Card>)cards.clone();
		Vector<Hand> same2 = CardUtils.findSameCardBySize(sour, 2);
		Iterator<Hand> it = same2.iterator();
		while (it.hasNext()) {
			Hand hand = it.next();
			if(outCard.equals(hand.firstElement())) {
				return true;
			}
		}
		return false;
	}
}
